// 位置追踪相关 API
// 使用统一的请求封装

import request from '@/utils/request';

// 获取宠物实时位置
export function getPetLocation(petId) {
  return request({
    url: `/mobile/pets/${petId}/location/current`,
    method: 'GET'
  });
}

// 获取宠物位置历史记录
export function getPetLocationHistory(petId, params = {}) {
  return request({
    url: `/mobile/pets/${petId}/location/history`,
    method: 'GET',
    data: params
  });
}

// 设置电子围栏
export function setPetFence(petId, data) {
  return request({
    url: `/mobile/pets/${petId}/fence`,
    method: 'POST',
    data,
    header: {
      isToken: true
    }
  });
}

// 获取电子围栏列表
export function getPetFenceList(petId) {
  return request({
    url: `/mobile/pets/${petId}/fence`,
    method: 'GET'
  });
}

// 更新电子围栏
export function updatePetFence(fenceId, data) {
  return request({
    url: `/mobile/fence/${fenceId}`,
    method: 'PUT',
    data,
    header: {
      isToken: true
    }
  });
}

// 删除电子围栏
export function deletePetFence(fenceId) {
  return request({
    url: `/mobile/fence/${fenceId}`,
    method: 'DELETE',
    header: {
      isToken: true
    }
  });
}

// 获取围栏告警记录
export function getFenceAlerts(fenceId, params = {}) {
  return request({
    url: `/mobile/fence/${fenceId}/alerts`,
    method: 'GET',
    data: params
  });
} 